package datastructure.tree.bst;

/**
 * @Description: 树的测试类
 * @author: Yang Qiang
 * @create: 2021-12-01 21:30
 */
public class BSTTest {
    public static void main(String[] args) {
        // 测试添加二叉搜索树
        BSTree<Integer> bsTree = new BSTree<>();
        bsTree.addEle(7);
        bsTree.addEle(3);
        bsTree.addEle(10);
        bsTree.addEle(1);
        bsTree.addEle(5);
        bsTree.addEle(9);
        bsTree.addEle(12);

        // 测试删除节点
        bsTree.remove(7);

        System.out.println(bsTree);
        // 测试前中后序遍历
//        bsTree.preOrder();
//        bsTree.minOrder();
//        bsTree.afterOrder();
//        System.out.println(bsTree.getSize());
//        System.out.println("-------------------------");

        // 测试前序非递归遍历
//        bsTree.preOrderNoDiGui();

        // 测试广度优先层级遍历
//        bsTree.levelOrder();


        // 测试搜索二叉树
//        BSTree<Integer> bsTree = new BSTree<>();
//        bsTree.addEle(7);
//        bsTree.addEle(3);
//        bsTree.addEle(10);
//        bsTree.addEle(1);
//        bsTree.addEle(5);
//        bsTree.addEle(9);
//        bsTree.addEle(12);
//        BSTree<Integer>.Node node = bsTree.searchEle(3);
//        System.out.println(node);
//        // 测试搜索父节点
//        BSTree<Integer>.Node node1 = bsTree.searchParentEle(5);
//        System.out.println(node1);
    }
}
